<template>
  <div>
    <div class="cardBody">
      <edu-table
        ref="mainTable"
        :data="tableList"
        :order="true"
        :selection="true"
        :pagination="true"
      >
        <el-table-column label="id" prop="configId" />
        <el-table-column label="标题" prop="configName" />
        <el-table-column label="描述" prop="description" />
        <el-table-column label="配置值" prop="configValue">
          <template slot-scope="scope">
            <el-input-number
              v-model="scope.row.configValue"
              clearable
              size="small"
            />
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" width="220px">
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="update(scope.row)"
              size="small"
            >
              保存
            </el-button>
          </template>
        </el-table-column>
      </edu-table>
    </div>
  </div>
</template>

<script>
import { querySnapshotConfig, updateSnapshotConfig } from "@/api/anyPhoto";
import mixins from "@/mixins";

export default {
  mixins: [mixins],
  data() {
    return {
      tableList: [],
      formData: {},
    };
  },
  methods: {
    async query() {
      let { returnObj } = await querySnapshotConfig();
      this.tableList = returnObj;
    },
    async update(row) {
      await updateSnapshotConfig([{
        configId: row.configId,
        configValue: row.configValue,
      }]);

      this.$message({
        type: "success",
        message: "配置修改成功",
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>
